﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Visifire.Gauges;

namespace CPPEI.Coolzon.UI.DataPartLib
{
    public partial class DataGaugeBase
    {
        public void SetRange(Gauge gauge)
        {
            if (XDataRanges != null && XDataRanges.Count > 0)
            {
                foreach (DataRange dataRange in XDataRanges)
                {
                    Visifire.Gauges.Range range = new Visifire.Gauges.Range();
                    range.StartValue = dataRange.StartValue;
                    range.EndValue = dataRange.EndValue;
                    range.StartWidth = dataRange.StartWidth;
                    range.EndWidth = dataRange.EndWidth;
                    range.Background = dataRange.Background==null? null : dataRange.Background.Brush;
                    range.BorderBrush = dataRange.BorderBrush==null? null : dataRange.BorderBrush.Brush;
                    range.BorderThickness = dataRange.BorderThickness;
                    range.Placement = Visifire.Gauges.PlacementTypes.Center;
                    gauge.Ranges.Add(range);
                }
            }
        }
        private List<DataRange> _XDataRanges;
        [Category("其他")]
        [DisplayName("范围")]
        [Description("XDataRanges")]
        [Editor(typeof(XProperty.Editors.XDataRangeEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "XDataRanges", "范围")]
        public List<DataRange> XDataRanges
        {
            get
            {
                return _XDataRanges;
            }
            set
            {
                _XDataRanges = value;
                ApplyXProperty();
            }
        }

        [Category("其他")]
        [DisplayName("数据串对应标识类型")]
        [Description("IndicatorsType")]
        [Editor(typeof(XProperty.Editors.XIndicatorsTypeEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "IndicatorsType", "数据串对应标识类型")]
        public IndicatorsType IndicatorsType
        {
            get
            {
                return indicatorsType;
            }

            set
            {
                indicatorsType = value;
                Refresh();
            }
        }

        private IndicatorsType indicatorsType;
    }
}
